function evalRPN(tokens: string[]): number {
  const temp: number[] = [];
  for (let i = 0; i < tokens.length; i++) {
    let curStr: string = tokens[i];
    if (curStr === "+" || curStr === "-" || curStr === "*" || curStr === "/") {
      let num1 = temp.pop()!;
      let num2 = temp.pop()!;
      if (curStr === "+") temp.push(num2 + num1);
      else if (curStr === "-") temp.push(num2 - num1);
      else if (curStr === "*") temp.push(num2 * num1);
      // Math.trunc() 方法会将数字的小数部分去掉，只保留整数部分
      else temp.push(Math.trunc(num2 / num1));
    } else {
      temp.push(+curStr);
    }
  }
  return temp.pop()!;
}
